#include <iostream>
#include <map>
#include <string>
int main(int argc, char *argv[])
{
    int n;
    while (1) {
        std::cin>>n;
        if(n==0)
            break;
        std::map<std::string, int> table;
        std::string color;
        for(int i = 0; i<n; i++)
        {
            std::cin>>color;
            if(table.find(color)!=table.end())
                table[color]+=1;
            else
                table[color]=0;
        }
        int max=0;
        std::string pcolor;
        for(std::map<std::string, int>::iterator ite=table.begin(); ite!=table.end(); ite++)
        {
            if(max<=ite->second)
            {
                max=ite->second;
                pcolor=ite->first;
            }
        }
        std::cout<<pcolor<<std::endl;

    }
}
